using System;
using System.Collections.Generic;
using System.Text;

namespace ArchSoft
{
    class CompositionStore:IStateMonitor
    {
        List<IStateMonitor> components;

        public CompositionStore()
        {
            components = new List<IStateMonitor>();
            //TODO: Demo build
            //components.Add(new ExcelStore());
            //components.Add(new MSProjectStore());
        }

        #region IStateMonitor Members

        public string FolderPath
        {
            set 
            {
                foreach (IStateMonitor stateComponent in components)
                {
                    stateComponent.FolderPath = value;
                }
            }
        }

        public void NewProject(string projectName)
        {
            foreach (IStateMonitor stateComponent in components)
            {
                stateComponent.NewProject(projectName);
            }
        }

        public void OpenProject(string projectName)
        {
             foreach (IStateMonitor stateComponent in components) 
             {
                 stateComponent.OpenProject(projectName);
             }
        }

        public void NewWindow(string Name, int order)
        {
            foreach (IStateMonitor stateComponent in components) { stateComponent.NewWindow(Name,order); }
        }

        public void RenameWindow(string name, int order)
        {
            foreach (IStateMonitor stateComponent in components) { stateComponent.RenameWindow(name, order); }
        }

        public void DeleteWindow(int startIndex, int num)
        {
             foreach (IStateMonitor stateComponent in components) { stateComponent.DeleteWindow(startIndex,num); }
        }

        public void RenameDrawing(int startIndex, int NumOfChild, string newName)
        {
             foreach (IStateMonitor stateComponent in components) { stateComponent.RenameDrawing(startIndex,NumOfChild,newName); }
        }

        public void NewDrawing(int startIndex, int NumOfChild, string newFile)
        {
             foreach (IStateMonitor stateComponent in components) { stateComponent.NewDrawing(startIndex,NumOfChild,newFile); }
        }

        public void DeleteDrawing(int startIndex, int NumOfChild, string deletedFile)
        {
             foreach (IStateMonitor stateComponent in components) { stateComponent.DeleteDrawing(startIndex,NumOfChild,deletedFile); }
        }

        public void CloseProject()
        {
             foreach (IStateMonitor stateComponent in components) { stateComponent.CloseProject(); }
        }

        public void FinishOpenProject()
        {
             foreach (IStateMonitor stateComponent in components) { stateComponent.FinishOpenProject(); }
        }

        public void CloseApplication()
        {
           // foreach (IStateMonitor stateComponent in components) { stateComponent.CloseApplication(); }
        }

        public static void CloseApplicaton()
        {
            //TODO: Demo Build
            System.Diagnostics.EventLog.WriteEntry("AAA", " CloseAppL");
            //ExcelStore.CloseApplication();
            //MSProjectStore.CloseApplication();
        }

        #endregion

        


       
     
    }
}
